#ifndef INFOBOX_H
#define INFOBOX_H

#include <QGraphicsWidget>
#include <QString>
#include <QRectF>
#include <QPainterPath>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include <QWidget>
#include <QGraphicsItem>
#include <QGraphicsTextItem>
#include <QDebug>
#include <QTextBlockFormat>
#include <QTextCursor>

class InfoBox : public QGraphicsWidget
{
    Q_OBJECT
public:
    explicit InfoBox(int dir, QString t, QGraphicsItem *parent = 0);
    ~InfoBox();

    void setText( QString t );
    void addLineOfText( QString t );
    void changeDirection( int dir );

    QRectF boundingRect() const;
    QPainterPath shape() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
               QWidget *widget);
    
signals:
    
public slots:

private:
    void setupTop();
    void setupBottom();

    int direction; //0 = top, 1 = right, 2 = bottom, 3 = left

    QString textToDraw;
    QGraphicsTextItem* textItem;

    QPoint trianglePt1;
    QPoint trianglePt2;
    QPoint trianglePt3;

    QRectF boundRect;
    QRectF textRect;

    QFont* font;

    int textSize;
    int textWidth;
    int textHeight;

    bool needToComputeTextBoundaries;
    
};

#endif // INFOBOX_H
